cc.Class({
    extends: cc.Component,

    properties: {
        show:cc.Label,
        collectBtn:cc.Node,
        LuckySpin:cc.Node,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {
     this.collect = false;
        this.collectBtn.on('click',function(){
            if(this.collect) return;
            cc.voicePlay.playEffect('click');
            this.collect = true;
            cc.configData.money = cc.configData.money + this.collectCoin;
            if(CC_JSB){
                cc.sys.localStorage.setItem("money",cc.configData.money);
                cc.find('Canvas').emit('money');
                this.node.active=false;
                this.LuckySpin.active=false;
            }else{
                cc.sdkbox.setDataAsync(cc.configData,function(){
                    cc.sys.localStorage.setItem("money",cc.configData.money);
                    cc.find('Canvas').emit('money');
                    this.node.active=false;
                    this.LuckySpin.active=false;
                }.bind(this));
            }
        },this)
    },
    init(num){
        this.collect = false;
        this.collectCoin = num;
        this.show.string = '+' +  this.collectCoin;
    },
    ads(){

    },
    // update (dt) {},
});
